# Contributor: Mehdi Chinoune <mehdi.chinoune@hotmail.com>

_realname=prettier-ada
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=25.0.0
pkgrel=2
pkgdesc="A high level string and text processing library. (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64')
msys2_references=(
  'aur: prettier-ada'
)
license=('spdx:Apache-2.0 WITH LLVM-exception')
url="https://github.com/AdaCore/prettier-ada"
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
         "${MINGW_PACKAGE_PREFIX}-gcc-ada"
         "${MINGW_PACKAGE_PREFIX}-gnatcoll-core"
         "${MINGW_PACKAGE_PREFIX}-libvss")
makedepends=("${MINGW_PACKAGE_PREFIX}-gprbuild")
source=("https://github.com/AdaCore/prettier-ada/archive/v${pkgver}/prettier-ada-${pkgver}.tar.gz")
sha256sums=('21782e6ddc031ae4b32fc42e7213fe0aed3377e895462bd7a279e38da6b60f1e')

build() {
  [[ -d "${srcdir}"/build-${MSYSTEM} ]] && rm -rf "${srcdir}"/build-${MSYSTEM}
  cp -r "${srcdir}/prettier-ada-${pkgver}" "${srcdir}"/build-${MSYSTEM}
  cd "${srcdir}"/build-${MSYSTEM}

  make BUILD_MODE=prod all
}

package() {
  cd "${srcdir}"/build-${MSYSTEM}

  make PREFIX="${pkgdir}"${MINGW_PREFIX} BUILD_MODE=prod install-all

  install -Dm644 "${srcdir}/prettier-ada-${pkgver}/LICENSE.txt" \
    "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
